package com.zhangliuliu.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhangliuliu.bean.GroupBean;
import com.zhangliuliu.service.GroupService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("group")
public class groupController {

    @Resource
    private GroupService groupService;

    @RequestMapping("add")
    @ResponseBody
    void addGroup(GroupBean groupBean){
        groupService.addGroup(groupBean);
    }
    @RequestMapping("find")
    @ResponseBody
    GroupBean find(int id){
       return groupService.find(id);
    }
    @RequestMapping("updateGroup")
    @ResponseBody
    void updateGroup(@RequestParam("id") int id, @RequestParam("leader") String leader,
                     @RequestParam("tell") String tell){
        groupService.updateGroup(id,leader,tell);
    }
    @RequestMapping("cutByItem")
    @ResponseBody
    IPage<GroupBean> cutByItem(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize,
                               @RequestParam("name") String name, @RequestParam("areaId") Integer areaId){
   return groupService.cutByItem(pageNo,pageSize,name,areaId);
    }
    //首页展示我总也觉得有问题
}
